<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns:ui="http://java.sun.com/jsf/facelets"
                template="/resources/template/template.xhtml"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:f="http://java.sun.com/jsf/core"
                xmlns="http://www.w3.org/1999/xhtml"
                xmlns:p="http://primefaces.org/ui"
                xmlns:poue="http://primefaces.org/ui/extensions">


    <ui:define name="content">

        <h:panelGroup >
            <h:form id="form"  >
                <p:growl />
                <p:panel id="panIx"  >

                    <f:facet name="header" >
                        <h:outputLabel value="List of Investigations by category"></h:outputLabel>
                        <p:commandButton ajax="false" value="Print" styleClass="noPrintButton" >
                            <p:printer target="panIx" />
                        </p:commandButton>
                        <p:commandButton id="excel" ajax="false" value="Excel" onclick="onSubmitButton();"  >
                            <p:dataExporter target="tbl" type="xls" fileName="List of Investigations of #{investigationController.category}"  />
                        </p:commandButton>
                        <p:selectOneMenu id="cmbCat" value="#{investigationController.category}" >
                            <f:selectItem itemLabel="List all" />
                            <f:selectItems value="#{investigationCategoryController.items}" var="c" itemLabel="#{c.name}" itemValue="#{c}" />
                            <f:ajax event="change" execute="cmbCat" render="tbl excel" />
                        </p:selectOneMenu>
                    </f:facet>
                    <div id="printHeader" style="text-align: center; font-family: serif;">
                        <h:outputLabel value="Ruhunu Hospital (Pvt) Ltd" style="font-size: 20px;"></h:outputLabel>
                        <br> </br>
                        <h:outputLabel value="Lab Investigation by category" style="font-family: serif;" ></h:outputLabel>
                    </div>
                    <p:dataTable id="tbl" rowIndexVar="rowIndex" value="#{investigationController.catIxs}" var="ix"  >
                        <p:column headerText="No." >
                            <h:outputLabel value="#{rowIndex + 1}" ></h:outputLabel>
                        </p:column>  
                        <p:column headerText="Investigation" >
                            <h:outputLabel value="#{ix.name}" ></h:outputLabel>
                        </p:column>
                        <p:column headerText="Institution" >
                            <h:outputLabel value="#{ix.institution.name}" ></h:outputLabel>
                        </p:column>
                        <p:column headerText="Department" >
                            <h:outputLabel value="#{ix.department.name}" ></h:outputLabel>
                        </p:column>
                    </p:dataTable>
                </p:panel>
            </h:form>
        </h:panelGroup>

        <h:form>




        </h:form>


    </ui:define>

</ui:composition>
